package com.luoran.bartalks.utils;

import java.math.BigDecimal;

import com.luoran.bartalks.entity.biz.BtPackingList;

/**
 * 箱单取列名
 * 
 * @author WMM 2018年10月22日上午10:25:21
 * @version 1.0
 */
public enum EnumPackingListColumnName {

	CODE(0, "箱单编码"), OWNER(1, "箱单所有者"), SHIPPER(2, "发货人"), RECEIVER(3, "收货人"), STARTPLACE(4, "起始地"), DESTINATION(5,
			"目的地"), EMPTYWEIGHT(6, "净重"), GROSSWEIGHT(7, "毛重"), VOLUME(8, "体积"), TAKEPHOTO(9, "是否强制拍照");

	private final Integer value;
	private final String name;

	EnumPackingListColumnName(Integer value, String name) {
		this.value = value;
		this.name = name;
	}

	public Integer getValue() {
		return this.value;
	}

	public String getName() {
		return this.name;
	}

	public static String getColumnName(Integer value) {
		String name = "";
		switch (value) {
		case 0:
			name = CODE.getName();
			break;
		case 1:
			name = OWNER.getName();
			break;
		case 2:
			name = SHIPPER.getName();
			break;
		case 3:
			name = RECEIVER.getName();
			break;
		case 4:
			name = STARTPLACE.getName();
			break;
		case 5:
			name = DESTINATION.getName();
			break;
		case 6:
			name = EMPTYWEIGHT.getName();
			break;
		case 7:
			name = GROSSWEIGHT.getName();
			break;
		case 8:
			name = VOLUME.getName();
			break;
		case 9:
			name = TAKEPHOTO.getName();
			break;
		default:
			name = "未知";
			break;
		}
		return name;
	}
	
	public static String getMethod(Integer value,BtPackingList data) {
		String text = "";
		switch (value) {
		case 0:
			text = data.getPackingListCode();
			break;
		case 1:
			text = data.getOwner();
			break;
		case 2:
			text = data.getShipper();
			break;
		case 3:
			text = data.getReceiver();
			break;
		case 4:
			text = data.getStartPlace();
			break;
		case 5:
			text =data.getDestination();
			break;
		case 6:
			text = data.getEmptyWeight().setScale(6, BigDecimal.ROUND_HALF_UP).toPlainString(); 
			break;
		case 7:
			text = data.getGrossWeight().setScale(6, BigDecimal.ROUND_HALF_UP).toPlainString(); 
			break;
		case 8:
			text = data.getVolume().setScale(6, BigDecimal.ROUND_HALF_UP).toPlainString();
			break;
		case 9:
			text = data.getTakePhoto()==0?"是":"否";
			break;
		default:
			text = "";
			break;
		}
		if(text==null) {
			text="";
		}
		return text;
	}
	
	
	
}
